import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
import container from '@/views/container/container'

export const constantRouterMap = [
  {
    path: '',
    redirect: 'index',
    component: container,
    children: [
      {
        path: 'index',
        name: '首页',
        component: () => import('@/views/empty'),
        meta: {
          title: '首页',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: '登录',
    component: () => import('@/views/login')
  },
  {
    path: '/manage',
    name: '权限管理',
    component: container,
    meta: {
      title: '权限管理',
      noCache: true
    },

    children: [
      {
        path: '/userManage',
        name: '用户管理',
        component: () => import('@/views/employee/userManage'),
        meta: {
          title: '用户管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/amlUser',
        name: 'aml用户管理',
        component: () => import('@/views/employee/amlUser'),
        meta: {
          title: 'aml用户管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/shopUser',
        name: '商城用户管理',
        component: () => import('@/views/employee/shopUser'),
        meta: {
          title: '商城用户管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/systemSetting',
        name: '菜单管理',
        component: () => import('@/views/employee/systemSetting'),
        meta: {
          title: '菜单',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/role',
        name: '角色管理',
        component: () => import('@/views/employee/role'),
        meta: {
          title: '角色',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/logs',
        name: '日志管理',
        component: () => import('@/views/employee/logs'),
        meta: {
          title: '日志管理',
          icon: 'home',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/operation',
    name: '运营管理',
    // redirect: 'operation',
    component: container,
    meta: {
      title: '运营作业',
      icon: 'home',
      noCache: true
    },

    children: [
      {
        path: '/orderDispatch',
        name: '配送管理',
        component: () => import('@/views/operation/orderDispatch'),
        meta: {
          title: '配送管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/handleProduct',
        name: 'handleProduct',
        component: () => import('@/views/operation/handleProduct'),
        meta: {
          title: '修改物料',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/addProduct',
        name: '物料',
        component: () => import('@/views/operation/addProduct'),
        meta: {
          title: '物料',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/liaohao',
        name: '料号信息',
        component: () => import('@/views/operation/liaohao'),
        meta: {
          title: '料号信息',
          icon: 'home',
          noCache: true
        }
      }, 
      {
        path: '/SampleManagement',
        name: '客服样品订单管理',
        component: () => import('@/views/support/SampleManagement'),
        meta: {
          title: '免费样品申请配送管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/liaohaoManage',
        name: '料号管理',
        component: () => import('@/views/operation/liaohaoManage'),
        meta: {
          title: '料号管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/Warehouse',
        name: '仓库管理',
        component: () => import('@/views/operation/Warehouse'),
        meta: {
          title: '仓库管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/product',
        name: '物料管理',
        component: () => import('@/views/operation/product'),
        meta: {
          title: '物料管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/Suppliers',
        name: '供应商管理',
        component: () => import('@/views/operation/Suppliers'),
        meta: {
          title: '供应商管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/supplierAdd',
        name: '新增供应商',
        component: () => import('@/views/operation/supplierAdd'),
        meta: {
          title: '新增供应商',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/specsAnalyze',
        name: '规格分析',
        component: () => import('@/views/operation/specsAnalyze'),
        meta: {
          title: '规格分析',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/supplierModify',
        name: '修改供应商',
        component: () => import('@/views/operation/supplierModify'),
        meta: {
          title: '修改供应商',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/Materials',
        name: '物料分类',
        component: () => import('@/views/operation/Materials'),
        meta: {
          title: '物料分类',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/MaterialsAdd',
        name: '新增物料分类',
        component: () => import('@/views/operation/MaterialsAdd'),
        meta: {
          title: '新增物料分类',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/MaterialsModify',
        name: '修改物料分类',
        component: () => import('@/views/operation/MaterialsModify'),
        meta: {
          title: '修改物料分类',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/uploadProduct',
        name: '上架管理',
        component: () => import('@/views/operation/uploadProduct'),
        meta: {
          title: '上架管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/uploadApply',
        name: '上架审核',
        component: () => import('@/views/operation/uploadApply'),
        meta: {
          title: '上架审核',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/addSeries',
        name: '料号',
        component: () => import('@/views/operation/addSeries'),
        meta: {
          title: '料号',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/makeup',
        name: '补料单申请',
        component: () => import('@/views/operation/makeup'),
        meta: {
          title: '补料单申请',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/verify',
        name: '补料单审核',
        component: () => import('@/views/operation/verify'),
        meta: {
          title: '补料单管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/OperationSample',
        name: '运营样品订单管理',
        component: () => import('@/views/operation/OperationSample'),
        meta: {
          title: '运营样品订单管理',
          icon: 'home',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/customer',
    name: 'AML客户管理',
    // redirect: '客服管理',
    component: container,
    meta: {
      title: 'AML客户管理',
      icon: 'home',
      noCache: true
    },

    children: [
      {
        path: '/account',
        name: 'AML客户信息',
        component: () => import('@/views/support/account'),
        meta: {
          title: 'AML客户信息',
          icon: 'home',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/support',
    name: '客服管理',
    // redirect: '客服管理',
    component: container,
    meta: {
      title: '客服管理',
      icon: 'home',
      noCache: true
    },

    children: [
      {
        path: '/community',
        name: '互动交流',
        component: () => import('@/views/support/community'),
        meta: {
          title: '互动交流',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/dateDownloado',
        name: '资料导出',
        component: () => import('@/views/support/dateDownloado'),
        meta: {
          title: '资料导出',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/order',
        name: '订单管理',
        component: () => import('@/views/support/order'),
        meta: {
          title: '商城订单',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/orderDetail',
        name: '订单详情',
        component: () => import('@/views/support/orderDetail'),
        meta: {
          title: '订单详情',
          icon: 'home',
          noCache: true
        }
      },//免费样品申请 客服样品订单管理
      {
        path: '/FreeSampleManagement',
        name: '免费样品申请',
        component: () => import('@/views/support/FreeSampleManagement'),
        meta: {
          title: '免费样品申请',
          icon: 'home',
          noCache: true
        }
      },//免费样品申请 客服样品订单管理
      {
        path: '/freeorderApplySendDetail',
        name: '审批与详情',
        component: () => import('@/views/support/freeorderApplySendDetail'),
        meta: {
          title: '审批与详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/exorderDetail',
        name: '运营样品订单详情',
        component: () => import('@/views/support/exorderDetail'),
        meta: {
          title: '运营样品订单详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/exorderApplySendDetail',
        name: '免费样品申请配送详情',
        component: () => import('@/views/support/exorderApplySendDetail'),
        meta: {
          title: '免费样品申请配送详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/SourceManagement',
        name: '客源管理',
        component: () => import('@/views/support/SourceManagement'),
        meta: {
          title: '客源管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/refunds',
        name: '客服退换货订单管理',
        component: () => import('@/views/support/refunds'),
        meta: {
          title: '退换货申请',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/refundsDetail',
        name: '发货详情',
        component: () => import('@/views/support/refundsDetail'),
        meta: {
          title: '发货详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/assess',
        name: '订单评价管理',
        component: () => import('@/views/support/assess'),
        meta: {
          title: '订单评价管理',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/assessDetail',
        name: '订单评价管理详情',
        component: () => import('@/views/support/assessDetail'),
        meta: {
          title: '订单评价管理详情',
          icon: 'home',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/data',
    name: '数据管理',
    component: container,
    meat: {
      title: '数据管理',
      icon: 'home',
      noCache: true
    },

    children: [
      {
        path: '/push',
        name: '数据推送',
        component: () => import('@/views/data/push'),
        meta: {
          title: '数据推送',
          icon: 'home',
          noCache: true
        }
      }
    ]
  },
  {
    path: '/finance',
    name: '财务管理',
    // redirect: 'finance',
    component: container,
    meta: {
      title: '财务管理',
      icon: 'home',
      noCache: true
    },

    children: [
      {
        path: '/FinancialOrder',
        name: '订单应收款审批',
        component: () => import('@/views/finance/FinancialOrder'),
        meta: {
          title: '订单应收款审批',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/SalesReport',
        name: '财务销售报表',
        component: () => import('@/views/finance/SalesReport'),
        meta: {
          title: '财务销售报表',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/FinancialOrderDetail',
        name: '财务订单详情',
        component: () => import('@/views/finance/FinancialOrderDetail'),
        meta: {
          title: '财务订单详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/orderDispatchDetail',
        name: '订单发货详情',
        component: () => import('@/views/finance/orderDispatchDetail'),
        meta: {
          title: '订单发货详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/salesReportDetail',
        name: '财务订单详情',
        component: () => import('@/views/finance/salesReportDetail'),
        meta: {
          title: '财务订单详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/receive',
        name: '销售收入报表',
        component: () => import('@/views/finance/receive'),
        meta: {
          title: '销售收入报表',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/receiveDetail',
        name: '销售收入报表详情',
        component: () => import('@/views/finance/receiveDetail'),
        meta: {
          title: '销售收入报表详情',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/SupplyPartner',
        name: '供应商对账表',
        component: () => import('@/views/finance/SupplyPartner'),
        meta: {
          title: '供应商对账表',
          icon: 'home',
          noCache: true
        }
      },
      {
        path: '/PurchaseStatement',
        name: '物料采购成本支出报表',
        component: () => import('@/views/finance/PurchaseStatement'),
        meta: {
          title: '物料采购成本支出报表',
          icon: 'home',
          noCache: true
        }
      }
      //      {
      //          path: '/receive',
      //          name: '订单列表',
      //          component: () =>
      //              import ('@/views/finance/record'),
      //          meta: {
      //              title: '订单列表',
      //              icon: 'home',
      //              noCache: true
      //          },
      //      },{
      //          path: '/orderDetail',
      //          name: '订单详情',
      //          component: () =>
      //              import ('@/views/finance/orderDetail'),
      //          meta: {
      //              title: '订单详情',
      //              icon: 'home',
      //              noCache: true
      //          },
      //      }
    ]
  }
]

export default new Router({
  // 防止跳转路由时页面不是在顶部
  scrollBehavior() {
    return { x: 0, y: 0 }
  },
  routes: constantRouterMap
})
